#include<bits/stdc++.h>
using namespace std;

//模拟
int main(){
    int x;
    unsigned long long n,ans=0;
    cin>>x>>n;
    //从周x开始经过n天
    int tmp = 0;
    int cnt = 0;
    for(int i = 0;i < n;i++){
        if(x != 6 && x != 7){
            ans += 250;
        }
       
        if(x == 7){
            x = 1;
        }
        else{
            x++;
        }
    }
    cout<<ans<<endl;




    return 0;
}